<?php
/*
 * This class hold all const value
 */
class CGlobal extends CComponent
{
	public static $ratesBalanceList = array('5'=>'5','10'=>'10','15'=>'15','20'=>'20','30'=>'30');
	
	//PAGING
	public static $ratePageSize = 10;
	public static $phonePageSize = 6;
	public static $paymentHisPageSize = 5;
	public static $callDetailPageSize = 4;
	public static $speedDialPageSize = 3;
	
	//CONTACT
	public static $mailUsername = 'quoctuan261@gmail.com';
	public static $mailPassword = 'faywpvhkgdwxegsn';
	
	//WEBSERVICE
	public static $wsCustID = '4156';
	public static $wsAccountID = '283';
	public static $wsPass = 'pass';
	public static $wsPinDefault = '111';
	public static $wsResellerId = '12';
	public static $wsResellerName = 'bao';
	
	
	public static $listSpeedDial = array(
		'1' => '1',
		'2' => '2',
		'3' => '3',
		'4'=>'4',
		'5'=>'5',
		'6'=>'6',
		'7'=>'7',
		'8'=>'8',
		'9'=>'9',
		'10','10',
		'11'=>'11',
		'12'=>'12',
		'13'=>'13',
		'14'=>'14',
		'15'=>'15',
		'16'=>'16',
		'17'=>'17',
		'18'=>'18',
		'19'=>'19',
		'20'=>'20',
	);
	
	/**
	 * 
	 * for contact form. Show contact category list
	 */
	public static function getContactCategoryList()
	{
		return array(
		    'Techincal'=>Yii::t('site','Techincal'),
		    'Billing'=>Yii::t('site','Billing'),
		    'Error Massages'=>Yii::t('site','Error Massages'),
		    'Other'=>Yii::t('site','Other'),
		);
	}

	/**
	 * 
	 * Format aninumber for addphonenumber
	 */
	public static function formatAniPhoneNumber($number)
	{
		$areaCode = substr($number, 0,3);
		$prefixCode = substr($number, 3, 3);
		$phoneNumber = substr($number, 6,4);
		
		return $areaCode."-".$prefixCode."-".$phoneNumber;
	}
	
	
	/*
	 * encrypt password
	 */
	public static function encrypt($value)
	{
		return md5($value);
	}
	
	/**
	 * Reseller encrypt key.
	 *
	 * @return string encrypt string for access api database
	 */	
	public static function getResllerKey() {
		$key = self::$wsPass;
	    $dt = gmdate("m/d/Y", time());
		$key =substr($dt,0,6).$key.substr($dt, 5);
		return md5($key);
	}
}